<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>

<body>
    <div>div1</div>
    <div>div2</div>
    <div>div3</div>
</body>
<script src="../jquery-3.4.1.js"></script>
<script>
    function each(target, fn) {
        

    }
//遍历arr数组
    function each(arr, callback) {
        for (var index = 0; index < arr.length; index++) {
            callback.call(arr[index], index, arr[index]);
        }
    }

    each([1, 5, 3, 8], function (index, item) {
        console.log({
            index: index,
            value: item
        })
        //  结果：{index: 0, value: 1}
        //           {index: 1, value: 5}
        //        {index: 2, value: 3}
        //       {index: 3, value: 8}
    })
</script>

</html>